# coding: utf-8
# Author：zgd
# Date ：2021/11/9 18:37
# Tool ：PyCharm
import logging
from datetime import timedelta
from redis import StrictRedis

# 基础环境信息
class Config(object):
    # 调试
    DEBUG = True
    SECRET_KEY = "SDADSDEWQE23423dsadasd23"

    # DB
    SQLALCHEMY_DATABASE_URI = "mysql+pymsql://root:mysql@39.106.77.10:3307/info1109"
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    #redis 存储高频内容，存储session，短信验证码
    REDIS_HOST = "39.106.77.10"
    REDIS_PORT = 6379

    # session
    SESSION_TYPE = "redis"  #session存储类型
    SESSION_REDIS = StrictRedis(host=REDIS_HOST,port=REDIS_PORT) #SESSION 存储服务器
    SESSION_USE_SIGNER =  True #签名
    PERMANENT_SESSION_LIFETIME = timedelta(days=1) # session过期时间为1day

    # 默认日志级别
    LEVEL_NAME = logging.DEBUG

class DevelopConfig(Config):
    pass

# pro环境配置信息
class ProductConfig(Config):
    # pro环境不需要debug
    DEBUG = False
    LEVEL_NAME = logging.ERROR

# 测试环境配置信息
class TestConfig(Config):
    pass

config_dict = {
    "develop":DevelopConfig,
    "product":ProductConfig,
    "test":TestConfig
}
